﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using WarehouseManager.Core;
using WarehouseManager.Model;

namespace WarehouseManager.DataAccess
{
    class NhacungcapAccess
    {
        dbConnection dbCon= new dbConnection();
        public NhacungcapAccess() { }
        public DataTable laytoanbonhacungcap(){
            return dbCon.executeSelectProcedureQueryNonParameter("proc_selectNhaCungCap");
        }
        public int themNhacungcap(Nhacungcap ncc)
        {
                SqlParameter[] listParam = new SqlParameter[6];
                SqlParameter nhacc = new SqlParameter("@maKH", SqlDbType.VarChar, 10);
                nhacc.Value = ncc.maNCC1;
                listParam[0] = nhacc;
                listParam[1] = new SqlParameter("@tenNCC", ncc.tenNCC1);
                listParam[2] = new SqlParameter("@diaChi", ncc.diaChi1);
                listParam[4] = new SqlParameter("@soDT", ncc.SoDT);
                listParam[5] = new SqlParameter("@email", ncc.email1);
                dbCon.executeInsertProcedureQuery("proc_updateNhaCungCap", listParam);
                return 1;

            
        }
    }
}
